package data;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class RandomTemplate implements Serializable {
	private int notemin, notemax, velocitymin, velocitymax;
	
	public RandomTemplate() {
		notemin = 1;
		notemax = 255;
		velocitymin = 1;
		velocitymax = 255;
	}

	public void setNotemin(int notemin) {
		this.notemin = notemin;
	}

	public int getNotemin() {
		return notemin;
	}

	public void setNotemax(int notemax) {
		this.notemax = notemax;
	}

	public int getNotemax() {
		return notemax;
	}

	public void setVelocitymin(int velocitymin) {
		this.velocitymin = velocitymin;
	}

	public int getVelocitymin() {
		return velocitymin;
	}

	public void setVelocitymax(int velocitymax) {
		this.velocitymax = velocitymax;
	}

	public int getVelocitymax() {
		return velocitymax;
	}

	@Override
	public void serialize(OutputStream os) {
		try {
			os.write(notemin);
			os.write(notemax);
			os.write(velocitymin);
			os.write(velocitymax);
			System.out.println("" + notemin);
			System.out.println("" + notemax);
			System.out.println("" + velocitymin);
			System.out.println("" + velocitymax);
		} 
		catch (IOException ioe) {
			ioe.printStackTrace();
		}
	}

	@Override
	public void deserialize(InputStream is) {
		try {
			notemin = is.read();
			notemax = is.read();
			velocitymin = is.read();
			velocitymax = is.read();
		} 
		catch (IOException ioe) {
			ioe.printStackTrace();
		}		
	}

	@Override
	public String toString() {
		return "" + notemin + " " + notemax + " " + velocitymin +  " " + velocitymax;
	}
}
